<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Coupondonatelog extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'wanlshop_coupon_donate_log';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];


    public function receive()
    {
        return $this->belongsTo('app\admin\model\wanlshop\coupon\Receive', 'coupon_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function send()
    {
        return $this->belongsTo('User', 'sender_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function receiver()
    {
        return $this->belongsTo('User', 'receiver_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
